% Integrand for conditional pdf of tildeW + tildeV evaluated at (c|u)

function out = cpdf_wv_integrand3(tildew,c,u,I,lam,b,barw,alphav,betav,alphaw)
% c, barv, alphav, betav must be a Ix1 column vectors

ltildew = length(tildew);
temp0 = reshape(tildew,1,ltildew);
temp1 = repmat(temp0,I,1);
temp2 = repmat(c,1,ltildew);
temp3 = (lam+2*b)*(temp2-temp1)/barw - 1;
temp4 = .5 + temp0*(lam+(I+1)*b)/2/barw;

paramva = repmat(alphav,1,ltildew);
paramvb = repmat(betav,1,ltildew);
paramw = exp(alphaw(1)*alphaw(2)*u)*ones(1,ltildew);

out = prod(betapdf(temp3,paramva,paramvb)).*betapdf(temp4,paramw,paramw);

